﻿using System;
using System.IO;
using System.Windows;
using DL.PhotoCollage.UI.Screensaver.Presentation;

namespace DL.PhotoCollage.UI.Screensaver
{
    public partial class App : Application
    {
        private ScreensaverController controller;

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            string localDataDirectory = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                @"DigitalLagniappe/Screensavers/PhotoCollage");

            this.controller = new ScreensaverController(Current, e.Args, localDataDirectory);
            this.controller.StartApplication();
        }

        private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            this.controller.HandleError(e.Exception);
            e.Handled = true;
        }
    }
}
